package les.anagrama;

import les.anagrama.util.Dictionary;
import les.anagrama.util.Level;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;

public class AnaGrama extends Activity {
	private static final int SELECT_LEVEL = 1;
	
	private Level level;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		level = Level.LEVEL_1;
		Dictionary.getInstance(this);
	}
	
	@Override
	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
		if (resultCode == RESULT_OK && requestCode == SELECT_LEVEL) {
			level = (Level) data.getExtras().getSerializable("level");
		}
	}

	public void play(View view) {
		Intent intent = new Intent(this, Play.class);
		intent.putExtra("level", level);
		startActivity(intent);
	}

	public void manual(View view) {
		startActivity(new Intent(this, Manual.class));
	}

	public void ranking(View view) {
		Intent intent = new Intent(this, Ranking.class);
		intent.putExtra("level", level);
		startActivity(intent);
	}

	public void level(View niew) {
		Intent intent = new Intent(this, les.anagrama.Level.class);
		intent.putExtra("level", level);
		startActivityForResult(intent, SELECT_LEVEL);
	}
}